<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>{:lang('USER_INDEXADMIN_INDEX')}</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('user/adminIndex/index')}">
        用户ID：
        <input class="form-control" type="text" name="uid" style="width: 200px;" value="{:input('request.uid')}"
               placeholder="请输入用户ID">
        关键字：
        <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{:input('request.keyword')}"
               placeholder="用户名/昵称/邮箱/手机">
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('user/adminIndex/index')}">清空</a>
    </form>
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>ID</th>
                <th>{:lang('USERNAME')}</th>
                <th>{:lang('NICENAME')}</th>
                <th>{:lang('AVATAR')}</th>
                <th>手机</th>
                <th>现金</th>
                <th>积分</th>
                <th>会员卡</th>
                <th>{:lang('REGISTRATION_TIME')}</th>

                <th>{:lang('STATUS')}</th>
                <th>{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <php>
                $time=time();
                $user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));
            </php>
            <foreach name="list" item="vo">
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo['user_login']?$vo['user_login']:($vo['mobile']?$vo['mobile']:lang('THIRD_PARTY_USER'))}
                    </td>
                    <td>{$vo['user_nickname']?$vo['user_nickname']:lang('NOT_FILLED')}</td>
                    <td><img width="25" height="25" src="{:url('user/public/avatar',array('id'=>$vo['id']))}"/></td>

                    <td>{$vo.mobile}</td>
                    <td>￥{$vo.balance}</td>
                    <td>{$vo.score}</td>
                    <td>
                        <php>

                            if($vo['card_type']){
                                $start_time=date('Y-m-d',$vo['card_strart_time']);
                                $end_time=date('Y-m-d',$vo['card_end_time']);
                                $y_time=$start_time.'至'.$end_time;
                                if($vo['card_type']==1){ echo " <button class='btn btn-primary'data-toggle='tooltip' title='$y_time' type='button'>体验卡计次【".$vo['card_num']."】</button>";}
                                if($vo['card_type']==2){ echo "<button class='btn btn-primary' data-toggle='tooltip' title='$y_time' type='button'>半年卡</button>";}
                                if($vo['card_type']==3){ echo "<button class='btn btn-primary 'data-toggle='tooltip' title='$y_time' type='button'>年卡</button>";}
                                if($vo['card_type']==4){ echo "<button class='btn btn-primary' data-toggle='tooltip' title='$y_time' type='button'>股东年卡</button>";}
                                if($vo['card_type']==5){ echo "<button class='btn btn-primary' >免费卡计次【".$vo['m_card_num']."】</button>";}
                            }else{
                                echo "未开通会员";
                            }
                        </php>
                        <php>
                            if($vo['card_type']==1&&$vo['card_end_time']>$time){
                        </php>
                            <a class="btn btn-warning js-ajax-dialog-btn"  data-msg="您确定要增加一次吗？" href="{:url('adminIndex/add_card_num',array('id'=>$vo['id']))}">+</a>
                            <a class="btn btn-info js-ajax-dialog-btn"  data-msg="您确定要减少一次吗？" href="{:url('adminIndex/del_card_num',array('id'=>$vo['id']))}">-</a>
                        <php>
                            }
                        </php>
                      <php>
                            if($vo['card_type']==5){
                        </php>
                            <a class="btn btn-warning js-ajax-dialog-btn"  data-msg="您确定要增加一次吗？" href="{:url('adminIndex/add_m_card_num',array('id'=>$vo['id']))}">+</a>
                            <a class="btn btn-info js-ajax-dialog-btn"  data-msg="您确定要减少一次吗？" href="{:url('adminIndex/del_m_card_num',array('id'=>$vo['id']))}">-</a>
                        <php>
                            }
                        </php>
                    </td>
                    <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>

                    <td>{$user_statuses[$vo['user_status']]}</td>
                    <td>
                        <neq name="vo.id" value="1">
                            <empty name="vo.user_status">
                                <a href="{:url('adminIndex/cancelban',array('id'=>$vo['id']))}"
                                   class="js-ajax-dialog-btn btn btn-danger"
                                   data-msg="{:lang('ACTIVATE_USER_CONFIRM_MESSAGE')}" >{:lang('ACTIVATE_USER')}</a>
                                <else/>
                                <a href="{:url('adminIndex/ban',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn btn btn-info"
                                   data-msg="{:lang('BLOCK_USER_CONFIRM_MESSAGE')}" >{:lang('BLOCK_USER')}</a>
                            </empty>
                            <else/>
                            <a style="color: #ccc;" class="btn btn-info">{:lang('BLOCK_USER')}</a>

                        </neq>
                        <button class="btn btn-success score" data="{$vo.id}" type="button">积分明细</button>
                        <button class="btn btn-success balance "data="{$vo.id}" type="button">余额明细</button>

                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>

<script>
    $(function () {
        $('.score').click(function () {
            var scoreId = $(this).attr('data');
            openIframeLayer("/admin/user/score_info.html?id=" + scoreId, '积分明细', {
                area: ['900px', '600px']
            });
        })
        $('.balance').click(function () {
            var balanceId = $(this).attr('data');
            openIframeLayer("/admin/user/balance_info.html?id=" + balanceId, '余额明细', {
                area: ['900px', '600px']
            });
        })
    })

</script>
</body>
</html>